package com.jia.explore.recursion;

import java.util.Arrays;

/**
 * @program: Leetcode
 * @description: 数组找最大的值
 * @author: STU756
 * @create: 2020-08-17 16:09
 */
public class MaxNum {

    public static int maxNum(int[] a, int L, int R) {
        if(L == R) {
            return a[L];
        }else {
            int v1 = a[L];
            int max = maxNum(a, L + 1, R);
            return Math.max(v1, max);
        }
    }
    public static void main(String[] args) {
        int[] a = {3,4,5,7,2,4,7,8,9,2,4};
        System.out.println(maxNum(a, 0, a.length - 1));
    }
}
